import { reqAddressList,reqTrade } from '@/api'
const state = {
    //地址信息列表
    addressList:[],
    //订单信息
    tradeInfo:{}
}
const actions = {
    //获取地址信息{
    async getAddress({commit}) {
        let res = await reqAddressList()
        if(res.code == 200){
            commit('ADDRESS',res.data)
        }
    },
    //获取订单新消息
    async getTrade({commit}){
        let res = await reqTrade()
        if(res.code == 200){
            commit('TRADEINFO',res.data)
        }
    }
}
const mutations = {
    ADDRESS(state,data){
        state.addressList = data
    },
    TRADEINFO(state,data){
        state.tradeInfo = data
    }
}
const getters = {}

export default {
    actions, state, mutations, getters
}